package com.wzdigit.wms.basic.mapper.core.basic;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wzdigit.framework.orm.mybatis.MyBatisRepository;
import com.wzdigit.mes.basic.dto.CustomerDto;
import com.wzdigit.mes.basic.dto.DataItemDetailDTO;
import com.wzdigit.wms.basic.domain.basic.UserDataPermission;
import com.wzdigit.wms.basic.client.response.basic.UserDataPermissionResponse;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 用户信息授权数据表 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2020-12-28
 */
@MyBatisRepository
public interface UserDataPermissionMapper extends BaseMapper<UserDataPermission> {
	
	List<Integer> selectByUserIdAndAttr(
			@Param("userId") Integer userId, @Param("attr") String attr);
	
	List<UserDataPermissionResponse> selectCustomerPerms(
			@Param("userId") Integer userId, 
			@Param("customers") List<CustomerDto> customers);
	
	List<UserDataPermissionResponse> selectDateItemPerms(
			@Param("attr") String attr, @Param("userId") Integer userId, 
			@Param("dataItemDetails") List<DataItemDetailDTO> dataItemDetails);
	
	int insertOfUpdateOne(@Param("userId") Integer userId, @Param("attr") String attr, 
			@Param("value") String value, @Param("status") Integer status,
			@Param("createUser") String createUser, @Param("createTime") Date createTime);
	
	int deleteNot(@Param("userId") Integer userId, @Param("attr") String attr,
			@Param("notValues") List<Integer> notValues);
}